/**
 * Created by 李爱珍 on 2016/11/22.
 */
'use strict';
const gulp=require('gulp');
gulp.task('default',[],()=>{
    console.log('gulp任务完成');
})
//1,js的压缩,但是gulp-uglify不支持es6语法，所以需要借助gulp-babel将cs6语法进行装换
//const minjs=require('gulp-uglify');
//const es6toes5=require('gulp-babel');
//gulp.task('minjs',()=>{
//    gulp.src(['./src/controllers/*.js','./src/routers/*.js','./src/model/*.js'],{base:'src'})
//    .pipe(es6toes5({presets: ['es2015']}))
//    .pipe(minjs())
//    .pipe(gulp.dest('dist/'));
//    console.log('js压缩完毕');
//});

const minjs = require('gulp-uglify');
const es6toes5 = require('gulp-babel');
gulp.task('minjs',()=>{

    gulp.src(['./src/controllers/*.js','./src/routers/*.js','./src/model/*.js'],{base:'src'})
        // gulp.src(['./src/test.js'],{base:'src'})
        .pipe(es6toes5({presets: ['es2015']})) //表示将 js文件由es6转换成es5
        .pipe(minjs()) //再来压缩就不会报错了
        .pipe(gulp.dest('dist'));
    console.log('js压缩完毕');
});
